﻿using BootstrapBlazor.Components;
using BPM.Web.Shared.Data;
using BPM.Web.Shared.Dependencies;
using BPM.Web.Shared.Extensions;

namespace BPM.Web.Shared.Service;

[Scoped(typeof(ISysOnlineUserService))]
public class SysOnlineUserService : BaseService, ISysOnlineUserService
{
    private readonly IOnlineUserClient _onlineUserClient;
    public SysOnlineUserService(IOnlineUserClient onlineUserClient, ToastService toast) : base(toast)
        => _onlineUserClient = onlineUserClient;

    public Task<QueryData<OnlineUserOutput>> PageAsync(OnlineuserPageInput input)
        => QueryAsync(_onlineUserClient.PageAsync(input));

    public Task<QueryData<OnlineUserOutput>> ListAsync()
        => QueryAsync(_onlineUserClient.ListAsync());

    public Task<bool> ForceExistAsync(OnlineUserOutput input)
        => ExecuteAsync(_onlineUserClient.ForceExistAsync(input.Adapt<OnlineUser>()));
}

